import unittest


class DemoTestCase(unittest.TestCase):

    # 无条件跳过
    @unittest.skip('跳过用例原因1')
    def test01(self):
        print('test01')

    # 条件为真时才会跳
    @unittest.skipIf(1 == 1, '跳过用例原因2')
    def test02(self):
        print('test02')

    # 条件为假时才会跳过
    @unittest.skipUnless(1 == 2, '跳过用例原因2')
    def test03(self):
        print('test03')

    # 预期测试结果为失败时
    @unittest.expectedFailure
    def test04(self):
        self.assertEqual(1, 2, '断言失败')


if __name__ == '__main__':
    unittest.main(verbosity=2)
